<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('stores', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('short_name');
            $table->string('telephone')->nullable();
            $table->string('phone')->nullable();
            $table->string('address');
            $table->decimal('lng', 10, 6)->default(99)->comment('经');
            $table->decimal('lat', 10, 6)->default(99)->comment('纬');
            $table->boolean('is_online')->default(false);
            $table->boolean('is_open')->default(true);
            $table->timestamps();
            $table->softDeletes();
        });

        \App\Models\Store::create([
            'name' => '线上店铺-无法删除',
            'short_name' => '线上店铺',
            'address' => '线上店铺',
            'is_online' => true,
        ]);
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('stores');
    }
};
